package com.x.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sentinel")
public class TestController {
    @GetMapping("getSentinelOne")
    @SentinelResource
    public String getSentinelOne() throws InterruptedException {
        Thread.sleep(1000);
        return "调用端口号为8001的Api接口"+Math.random();
    }
    @GetMapping("getSentinelTwo/{name}")
    @SentinelResource
    public String getSentinelTwo(@PathVariable("name") String name) throws InterruptedException {
        return "调用端口号为8001的Api接口"+Math.random() + name;
    }
}
